﻿<phone:PhoneApplicationPage 
    xmlns:local="clr-namespace:MTGScore"
    local:TiltEffect.IsTiltEnabled="True"
    x:Class="MTGScore.HistoryPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True" Loaded="HistoryPage_Loaded">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="100" />
        </Grid.RowDefinitions>
        
        <!--Pivot Control-->
        <controls:Pivot Title="{Binding Path=Strings.Title, Source={StaticResource LocalizedStrings }}" Name="PivotControl" SelectionChanged="PivotControl_SelectionChanged">
            <!--Pivot item one-->
            <controls:PivotItem Header="{Binding Path=Strings.List, Source={StaticResource LocalizedStrings }}" Name="ListPivot_Name">
                <Grid>
                    <ListBox Name="SavedMatches_List" SelectionMode="Single" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Grid.Row="2" Grid.ColumnSpan="5" SelectionChanged="SavedMatches_List_SelectionChanged">

                    </ListBox>
                </Grid>
            </controls:PivotItem>

            <!--Pivot item two-->
            <controls:PivotItem Name="HistoryPivot_Name" Header="{Binding Path=Strings.History, Source={StaticResource LocalizedStrings }}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70*" />
                        <ColumnDefinition Width="70*" />
                        <ColumnDefinition Width="70*" />
                        <ColumnDefinition Width="70*" />
                        <ColumnDefinition Width="140*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50*" />
                        <RowDefinition Height="50*" />
                        <RowDefinition Height="350*" />
                    </Grid.RowDefinitions>
                    <!--<phone:WebBrowser HorizontalAlignment="Left" Name="webBrowser_History" VerticalAlignment="Top" Height="424" Width="454" Visibility="Collapsed" />-->
                    <!--<ListBox Name="Moments_List" SelectionMode="Multiple" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Grid.Row="2" Grid.ColumnSpan="5" SelectionChanged="Moments_List_SelectionChanged">

                    </ListBox>-->

                    <ListBox x:Name="Moments_List" Margin="0,0,-12,0" ItemsSource="{Binding SavedHistory}" SelectionMode="Single" Grid.Row="2" Grid.ColumnSpan="5">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,17">
                                    <TextBlock Text="{Binding pv1}" TextWrapping="NoWrap" Margin="30,0,0,0" Style="{StaticResource PhoneTextNormalStyle}"/>
                                    <TextBlock Text="{Binding infect1}" TextWrapping="NoWrap" Margin="102,-27,0,0" Style="{StaticResource PhoneTextNormalStyle}" />
                                    <TextBlock Text="{Binding pv2}" TextWrapping="NoWrap" Margin="180,-27,0,0" Style="{StaticResource PhoneTextNormalStyle}" />
                                    <TextBlock Text="{Binding infect2}" TextWrapping="NoWrap" Margin="260,-27,0,0" Style="{StaticResource PhoneTextNormalStyle}" />
                                    <TextBlock Text="{Binding timespan}" TextWrapping="NoWrap" Margin="340,-27,0,0" Style="{StaticResource PhoneTextNormalStyle}" />
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                    <TextBlock Height="40" Width="140" Name="History_Player1_Name" Text="{Binding Path=Strings.Player_1, Source={StaticResource LocalizedStrings }}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextAlignment="Center" Grid.ColumnSpan="2" Margin="6,4" />
                    <TextBlock Height="40" Width="140" Name="History_Player2_Name" Text="{Binding Path=Strings.Player_2, Source={StaticResource LocalizedStrings }}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextAlignment="Center" Grid.Column="2" Grid.ColumnSpan="2"/>
                    <TextBlock Height="40" Width="140" Name="History_Timer_Name" Text="{Binding Path=Strings.Time, Source={StaticResource LocalizedStrings }}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextAlignment="Center" Grid.Column="4" Grid.RowSpan="2" />
                    <TextBlock Height="40" Width="70" Name="History_Player1_Life" Text="PV" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextAlignment="Center" Grid.Row="1" Grid.Column="0" />
                    <TextBlock Height="40" Width="70" Name="History_Player1_Center" Text="" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextAlignment="Center" Grid.Row="1" Grid.Column="1" />
                    <TextBlock Height="40" Width="70" Name="History_Player2_Life" Text="PV" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextAlignment="Center" Grid.Row="1" Grid.Column="2" />
                    <TextBlock Height="40" Width="70" Name="History_Player2_Center" Text="" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextAlignment="Center" Grid.Row="1" Grid.Column="3" />
                </Grid>

            </controls:PivotItem>
        </controls:Pivot>

        <Grid Name ="AdControl"  xmlns:adctl="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI" Grid.Row="1">
            <adctl:AdControl Height="80" Width="480" AdUnitId="32126" ApplicationId="b76d31a7-58ed-4379-bf66-a32f00905f2d" AdModel="Contextual" />
        </Grid>

    </Grid>

    
    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <!--
            <shell:ApplicationBarIconButton x:Name="DeleteHistory_Button" IconUri="/Images/dark/delete.png" Text="Delete" Click="DeleteHistory_Button_Click"/>
            <shell:ApplicationBarIconButton x:Name="SendEmail_Button" IconUri="/Images/dark/mail.png" Text="E-Mail" Click="SendEmail_Button_Click"/>
            -->
            <shell:ApplicationBar.MenuItems>
                <!--
                <shell:ApplicationBarMenuItem x:Name="DeleteAllHistories_Button" Text="Delete All" Click="DeleteAllHistories_Button_Click"/>
                -->
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    
</phone:PhoneApplicationPage>